package top.szhome.develop.convert;

import org.apache.commons.lang3.StringUtils;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.MappingConstants;
import top.szhome.framework.core.tools.support.BaseConverter;
import top.szhome.develop.dto.PropertyDTO;
import top.szhome.develop.entity.Property;
import top.szhome.develop.vo.PropertyVO;

import java.util.Arrays;
import java.util.Collections;
import java.util.List;

/**
 *  对象转换器
 *
 * @author 唐加利
 * @date 2023/08/21
 **/
@Mapper(componentModel = MappingConstants.ComponentModel.SPRING)
public interface PropertyConverter extends BaseConverter<PropertyDTO, Property, PropertyVO> {

    default String toString(List<String> value) {
        return StringUtils.join(value, ",");
    }

    default List<String> toList(String str) {
        return Arrays.asList(str.split(","));
    }

}
